<?php
$menumark = 'order';
function getch($state){
    if($state == 0){
        return '待确认';
    }else if($state == 1){
        return '待发货';
    }else if($state == 2){
        return '已发货';
    }else if($state == 3){
        return '已确认';
    }else if($state == 4){
        return '退货';
    }else if($state == 5 ){
        return '取消订单';
    }else if($state == 6 ){
        return '订单关闭';
    }
}
switch ($act) {
    case 'edit':
        $view = $db->pe_select("order",array('order_id'=>$_g_id),'*');
        $seo = pe_seo($menutitle='订单信息', '', '', 'admin');
        include(pe_tpl('hotelorder_view.html'));
    break;
    case 'state':
        if($db->pe_update("order",array('order_id'=>$_g_id),array('order_state'=>1))){
            pe_success('修改成功');
        }else{
            pe_error('修改失败');
        }
    break;
    default :
        if ($_g_express) {
            if($db->pe_update("order",array('order_id'=>$_g_id),array('order_express'=>$_g_express,'order_sendtime'=>date('Y-m-d H:m:s', time()),'order_state'=>2))){
                pe_success('修改成功!!!');
            }else{
                pe_error('修改失败!!!!');
            }
        }
        if($_g_cate == 'new'){
            $sqlwhere1 .= " and `order_state` = '0'";
        }else if($_g_cate == 'waitsend'){
            $sqlwhere1 .= " and `order_state` = '1'";
        }else if($_g_cate == 'oldsend'){
            $sqlwhere1 .= " and `order_state` = '2'";
        }else if($_g_cate == 'check'){
            $sqlwhere1 .= " and `order_state` = '3'";
        }else if($_g_cate == 'return'){
            $sqlwhere1 .= " and `order_state` = '4'";
        }else if($_g_cate == 'cancel') {
            $sqlwhere1 .= " and `order_state` = '5'";
        }else if($_g_cate == 'close') {
            $sqlwhere1 .= " and `order_state` = '6'";
        }
        $_g_name && $sqlwhere .= " and `order_number` = '{$_g_name}'";
        $sqlwhere .= " order by order_subtime desc";
        $sqlwhere0 = $sqlwhere1.$sqlwhere;
        $info_list = $db->pe_selectall("order",$sqlwhere0,'*',array(7,$_g_page));

        // print_r($info_list);
        $list = $db->pe_num("order",$sqlwhere);
        $new = $db->pe_num("order"," and `order_state` = '0'".$sqlwhere);
        $waitsend = $db->pe_num("order"," and `order_state` = '1'".$sqlwhere);
        $oldsend = $db->pe_num("order"," and `order_state` = '2'".$sqlwhere);
        $check = $db->pe_num("order"," and `order_state` = '3'".$sqlwhere);
        $return = $db->pe_num("order"," and `order_state` = '4'".$sqlwhere);
        $cancel = $db->pe_num("order"," and `order_state` = '5'".$sqlwhere);
        $close = $db->pe_num("order"," and `order_state` = '6'".$sqlwhere);
        $tongji['all'] = $db->pe_num("order");
        $seo = pe_seo($menutitle='订单列表', '', '', 'admin');
        include(pe_tpl('order_list.html'));
    break;
}
?>